// vite.config.js
import {defineConfig} from "vite";
import vue from "@vitejs/plugin-vue";
import viewport from "./config/px2vw.config.js";

// 设置IP地址为0.0.0.0，这样可以在同一网络下的其他设备上进行访问
const host = "0.0.0.0";

export default defineConfig({
    base: '', // 线上加antiFake
    plugins: [vue()],
    server: {
        host: host,
        port: 3000,
        proxy: {
            '/api': {
                // target: 'http://172.16.222.153:9007',// 测试
                // target: 'http://172.16.222.7:9007',// 后端
                target: 'http://127.0.0.1:9007',// 本地
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, '')
            }
        }
    },
    css: {
        postcss: {
            plugins: [...viewport],
        },
    },
});
